<?php

namespace App\Http\Validate\Purchase;

use App\Http\Validate\BaseValidate;

/**
 * 权限组验证器
 */
class PurchaseSettlePriceLog extends BaseValidate
{
    //验证规则
    protected $rule = [];
    //自定义验证信息
    protected $message = [];

    public function __construct($doaction = 'add')
    {
        if ($doaction == 'add') {
            $this->rule = [
                'base_price' => 'required|integer|gt:0',
                // 'steel_factory_id' => 'required|integer|gt:0',
            ];
            $this->message = [

                'base_price.required' => '单价未填写',
                'base_price.integer' => '单价需大于0',
                'base_price.gt' => '单价需大于0',
                // 'steel_factory_id.required' => '钢厂未选择',
                // 'steel_factory_id.integer' => '无效钢厂',
                // 'steel_factory_id.gt' => '无效钢厂',
            ];
        } else {
            $this->rule = [
                'base_price' => 'required|integer|gt:0',
                'log_id' => 'required|integer|gt:0',
            ];
            $this->message = [
                'base_price.required' => '单价未填写',
                'base_price.integer' => '单价需大于0',
                'base_price.gt' => '单价需大于0',
                'log_id.required' => '无效参数',
                'log_id.integer' => '无效参数',
                'log_id.gt' => '无效参数',
            ];
        }
    }
}
